<!-- register.html -->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户注册 - 我的网站</title>
    <style>
        /* 公共样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: #f0f8ff;
        }

        nav {
            background-color: #2c3e50;
            padding: 1rem 5%;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            color: white;
            font-size: 1.5rem;
            font-weight: bold;
            text-decoration: none;
        }

        /* 注册页面专用样式 */
        .register-container {
            max-width: 500px;
            margin: 4rem auto;
            padding: 2rem;
            background: white;
            border-radius: 10px;
            box-shadow: 0 5px 25px rgba(0,0,0,0.1);
        }

        .register-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .register-header h1 {
            color: #2c3e50;
            margin-bottom: 1rem;
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        label {
            display: block;
            margin-bottom: 0.5rem;
            color: #666;
        }

        input {
            width: 100%;
            padding: 0.8rem;
            border: 2px solid #e0e0e0;
            border-radius: 5px;
            font-size: 1rem;
        }

        .btn {
            padding: 0.8rem 2rem;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            width: 100%;
            font-size: 1rem;
            transition: transform 0.2s;
        }

        .btn-success {
            background-color: #2ecc71;
            color: white;
        }

        .btn:hover {
            transform: translateY(-2px);
        }

        .login-link {
            text-align: center;
            margin-top: 1.5rem;
            color: #666;
        }

        .login-link a {
            color: #3498db;
            text-decoration: none;
        }

        .password-rules {
            color: #666;
            font-size: 0.9rem;
            margin: 1rem 0;
        }
    </style>
</head>
<body>
    <nav>
        <a href="/" class="logo">我的网站</a>
    </nav>

    <div class="register-container">
        <div class="register-header">
            <h1>创建账户</h1>
            <p>加入我们的社区</p>
        </div>
        
        <form action="/register" method="GET">
            <div class="form-group">
                <label>用户名</label>
                <input type="text" name="username" required>
            </div>

            <div class="form-group">
                <label>电子邮箱</label>
                <input type="email" name="email" required>
            </div>

            <div class="form-group">
                <label>密码</label>
                <input type="password" name="password" required>
            </div>

            <div class="form-group">
                <label>确认密码</label>
                <input type="password" name="confirm_password" required>
            </div>

            <div class="password-rules">
                * 密码至少8个字符，包含字母和数字
            </div>

            <button type="submit" class="btn btn-success">立即注册</button>
        </form>

        <div class="login-link">
            已有账户？<a href="/Login.html">立即登录</a>
        </div>
    </div>

    <script>
        // 密码匹配验证
        document.querySelector('form').addEventListener('submit', function(e) {
            const password = document.querySelector('input[name="password"]').value;
            const confirm = document.querySelector('input[name="confirm_password"]').value;
            
            if(password !== confirm) {
                alert('两次输入的密码不一致');
                e.preventDefault();
            }

            if(password.length < 8) {
                alert('密码长度至少8位');
                e.preventDefault();
            }
        });
    </script>
</body>
</html>